#!/usr/bin/env python
# coding=utf-8

import urllib, json, sys,time,re
from optparse import OptionParser


def getData(url):
    res = urllib.urlopen(url)
    data = res.read()
    return data

def parseFileds(flag,name,curnum,minnum,maxnum):
    global perdata,warningstr,criticalstr
    perdata=(perdata+" "+name+"="+str(curnum)+";"+str(minnum)+";"+str(maxnum))
    if (curnum<minnum):
        return 0
    elif (curnum>minnum and curnum<maxnum):
        warningstr=(warningstr+flag+"="+str(curnum)+",")
        return 1
    else:
        criticalstr=(criticalstr+flag+"="+str(curnum)+",")
        return 2

def main():
    global htmldata,warningstr,criticalstr,perdata,ip,ctime

    cmd_parser = OptionParser(version="%prog 0.1")
    cmd_parser.add_option("-u", "--url", type="string", action="store", dest="url", help="vist web path")

    (cmd_options, cmd_args) = cmd_parser.parse_args()

    if not (cmd_options.url):
        print ""
        return(3)

    try:
        htmldata = getData(cmd_options.url)
        data=json.loads(htmldata)
        templist=data.get("status")
        for curitem in templist.keys():
            print curitem
    except IOError as (errno, strerror):
        print ""
        return(3)
    except:
        print ""
        return(3)

if __name__ == '__main__':
    sys.exit(main())